package pt.nmfa.peste.session;

import pt.nmfa.peste.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("channelsList")
public class ChannelsList extends EntityQuery<Channels> {

	private static final String EJBQL = "select channels from Channels channels";

	private static final String[] RESTRICTIONS = {
			"lower(channels.epgPos) like lower(concat(#{channelsList.channels.epgPos},'%'))",
			"lower(channels.name) like lower(concat(#{channelsList.channels.name},'%'))",
			"lower(channels.image) like lower(concat(#{channelsList.channels.image},'%'))",
			"lower(channels.channelSigla) like lower(concat(#{channelsList.channels.channelSigla},'%'))", };

	private Channels channels = new Channels();

	public ChannelsList() {
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public Channels getChannels() {
		return channels;
	}
}
